package com.flong.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class Test1 {

	
	public static void main(String[] args) throws Exception{
		
		//Thread.sleep(1000);
		for(int i=1; i<=87; i++){
			String strUrl  = "http://www.999zx.cn/jingying.htm?page="+i;
			Document doc =Jsoup.connect(strUrl).timeout(5000).header("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0").get();
			Elements lis = doc.getElementsByClass("jy_list").select("li:gt(0)");
			for(Element li :lis){
				String username = li.getElementsByClass("div2").select("a:eq(0)>span:eq(0)").text();
				//String zhiye = li.getElementsByClass("div2").select("p:eq(0)").text();
				//String tuandui = li.getElementsByClass("div2").select("p:eq(1)").text();
				String tel = li.getElementsByClass("div4").select("p:eq(0)").text();
				if(tel!=null && !"".equals(tel.trim())){
					System.out.println(username+"="+tel);
				}
			}
			
		}
	}
}


